package com.admin.creditcard.controller;

import com.admin.creditcard.domain.CreditRecord;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.client.model.vo.common.Result;
import com.client.model.vo.common.ResultCodeEnum;
import org.apache.commons.collections4.Get;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : RulerWood
 * @Data : 2024/4/12 - 15:12
 */
@RestController
@RequestMapping("/admin/creditCard")
public class ApplyCreditController {
    @Autowired
    private com.admin.creditcard.service.CreditRecordService creditRecordService;

    /**
     * 查询信息列表（分页展示）
     * @param offset
     * @param pageSize
     * @return
     */
    @GetMapping("/applyRecord")
    public Result applyRecord(@RequestParam(defaultValue = "1",name = "offset")Integer offset,
                                                  @RequestParam(defaultValue = "5",name = "pageSize")Integer pageSize){
        return Result.build(this.creditRecordService.page(new Page<>(offset,pageSize)), ResultCodeEnum.SUCCESS);
    }

    /**
     * 申请不通过
     * @param id
     * @return
     */
    @GetMapping("/refuseTheApply")
    public Result refuseTheApply(@RequestParam Long id){
        return Result.build(this.creditRecordService.refuseTheApply(id), ResultCodeEnum.SUCCESS);
    }

    /**
     * 审核通过
     * @param id 当前记录表中的主键
     * @return
     */
    @GetMapping("/successApply")
    public Result<String> successApply(@RequestParam Long id){
        return this.creditRecordService.successApply(id);
    }


}
